<!DOCTYPE html>
<html>
	<head lang="en">
		<meta charset="UTF-8">
		<title>列表</title>
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
		<meta name="apple-touch-fullscreen" content="yes">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta name="format-detection" content="telephone=no">
		<meta http-equiv="x-rim-auto-match" content="none" />
		<meta name="HandheldFriendly" content="true" />
		<link rel="stylesheet" href="assets/css/amazeui.min.css">
		<link rel="stylesheet" href="assets/css/style.css">
		<link type="text/css" rel="stylesheet" href="assets/css/demo.css">
			<!--<script src="assets/js/demo.js"></script>-->
			<style>
				html{
					height: initial;
				}
				body{
					zoom:1;
					height: 100%;
				}
				.shadow{
					zoom:1;
					width:100%;
					height: 100%;
					position: absolute;
					background: rgba(0,0,0,0.6);
					z-index:1;
				}
				/*body::after{
					content: "";
					display: block;
				}*/
				.am-datepicker tr.am-datepicker-header {
					font-size: 1.6rem;
					color: #fff;
					background: #69bae0;
				}
				.am-datepicker-select {
					color: #fff;
				}
				
				.hunt-left {
					position: absolute!important;
					top: 0!important;
				}
				/*#shadow{
					height:100%;
					width: 100%;
					background:#ccc;
					position: absolute;
					line-height: 100%;
					text-align: center;
					display: none;
				}
				#shadow span{
					position: absolute;
					font-size: 2rem;
					top:50%;
					left:20%;
					font-family: "微软雅黑";
					
				}*/
				.screening{
					z-index: 1000!important;
				}
				#myHeader{
					
				}
				/*.search_body::after{
					content:"这个地方暂时没有线路哦";
					width:100%;
					font-size:2rem;
					font-family:"微软雅黑";
					position:absolute;
					top:22rem;
					left:0rem;
					color:#666;
					right:0rem;
					text-align: center;
				}*/
				#from_idx{
					height:100%;
					width:100%;
					color:#fff;
					/*font-weight:bold;*/
					font-size:1.8rem;
					line-height: inherit;
					text-align: center;
				}
				.order-right h2{
					display: block!important;
				}
			</style>
	</head>

	<body>
		<header id="myHeader" data-am-widget="header" class="am-header am-header-default">
			<div class="am-header-left am-header-nav"><a href="javascript:;" onClick="javascript :history.back(-1);"><img src="assets/images/left.png"></a></div><div id="from_idx"></div>
        </h1>
			<!--<div class="am-header-right am-header-nav">
				<button id="search_btn">搜索</button>
			</div>-->
		</header>
<!--		<div style="width: 100%; height:4rem;"></div>-->
		<!-- screening -->
		<!--<div id="shadow">
			<span>这个地方暂时没有线路哦</span>
		</div>-->
		<div class="shadow" style="width: 100%;height: 100%;display: none;">
			
		</div>
		<div class="screening">
				<ul>
					<li class="Regional">目的地</li>
					<span>|</span>
					<li class="Brand">时间天数</li>
					<span>|</span>
					<li class="Sort">筛选</li>
				</ul>
			</div>
			<div class="grade-eject" id="destination_box" style="z-index: 11;">
			<ul class="grade-w">
				<div class="hunt">
					<ul class="hunt-left">
						<!--<li>
							<a href="#">港澳台</a>
						</li>
						<li>
							<a href="#">出境游</a>
						</li>
						<li class="active">
							<a href="#">国内游</a>
						</li>
						<li>
							<a href="#">邮轮</a>
						</li>
						<li>
							<a href="#">自由行</a>
						</li>-->
					</ul>
					<div class="hunt-right" style="padding-bottom: 1rem">
						<!--<h2>云南</h2>
						<span>大理</span><span>昆明</span><span>西双版纳</span>
						<span>丽江</span>
						<h2>西北</h2>
						<span>嘉峪关</span><span>敦煌</span><span>张掖</span>
						<span>华山</span><span>开封</span><span>宁夏</span>
						<span>银川</span>
						<h2>云南</h2>
						<span>大理</span><span>昆明</span><span>西双版纳</span>
						<span>丽江</span>
						<h2>西北</h2>
						<span>嘉峪关</span><span>敦煌</span><span>张掖</span>
						<span>华山</span><span>开封</span><span>宁夏</span>
						<span>银川</span>-->

					</div>
					<div class="clear"></div>
				</div>
			</ul>
		</div>
		<div class="Category-eject" id="time_box">
			<ul style="background: #fff;z-index:2;position: absolute; height:16rem">
				<li>
					<span style="float: left;">出发日期：</span>
					<form action="" class="am-form" data-am-validator>
						<input id="init_time" readonly="true" onkeydown="return false" style="padding:0 0 0 3px;width:8.5rem; height:2.4rem; float: left;font-size:1rem!important;line-height: 2.4rem;background-color: inherit;"	 type="text" class="am-form-field" placeholder="" data-am-datepicker/>
						<span style="float: left;">~</span>
						<input id="fina_time" readonly="true" style="background-color: inherit;padding:0 0 0 3px;width:8.5rem; height:2.4rem; float: left;font-size:1rem!important;line-height: 2.4rem;" type="text" class="am-form-field" placeholder="" data-am-datepicker/>
					</form>
					<div class="clear"></div>
				</li>
				<li>
					<span style="float: left;">行程天数：</span>
					<div class="shuzi" style="border: 1px solid #ccc;width: 8.2rem;height:2.7rem">
						<button type="button" class="minus" style="background-color: inherit;">-</button>
						<input id="period" type="number" class="am-num-text" readonly="readonly" value="0" style="border-left: 1px solid #ccc;border-right: 1px solid #ccc;"/>
						<button type="button" class="plus" style="background-color:inherit;">+</button>
					</div>
					<button class="btn-qd" id="time_btn">确定</button>
				</li>
			</ul>
		</div>
		<div class="Sort-eject Sort-height" id="filter_box">
			<ul class="Sort-Sort" id="Sort-Sort" style="height: 20rem;">
				<li sort="1">
					<img src="assets/images/x6.png" class="img1"> 价格最低开始排序
					<img src="assets/images/x11.png" class="img img1">
				</li>
				<li sort="2">
					<img src="assets/images/x7.png" class="img1"> 价格最高开始排序
					<img src="assets/images/x10.png" class="img img1">
				</li>
				<li sort="3">
					<img src="assets/images/x8.png" class="img1"> 最近的出发日期排序
					<img src="assets/images/x11.png" class="img img1">
				</li>
				<li sort="4">
					<img src="assets/images/x8.png" class="img1"> 最远的出发日期排序
					<img src="assets/images/x10.png" class="img img1">
				</li>
				<li sort="5">
					<img src="assets/images/x9.png" class="img1"> 最少的行程天数排序
					<img src="assets/images/x11.png" class="img img1">
				</li>
				<li sort="6">
					<img src="assets/images/x9.png" class="img1"> 最多的行程天数排序
					<img src="assets/images/x10.png" class="img img1">
				</li>
			</ul>
		</div>
		<div style="width: 100%; height:7.1rem;"></div>
		<div class="ly-list">
			<ul class="ly">
				<!--<li>
					<a href="show.html">
						<img src="assets/images/image.png" alt="">
						<span>深圳市出发</span>
					</a>
					<div class="order-right">
						<h2>【纯玩】三亚蜈支洲岛南湾猴岛西岛南山四天双飞团</h2>
						<span>天数：4天</span><b>￥1899</b>
						<font>团期：04-18,04-19,04-20</font>
					</div>
				</li>
				<li>
					<a href="show.html">
						<img src="assets/images/image.png" alt="">
						<span>深圳市出发</span>
					</a>
					<div class="order-right">
						<h2>【纯玩】三亚蜈支洲岛南湾猴岛西岛南山四天双飞团</h2>
						<span>天数：4天</span><b>￥1899</b>
						<font>团期：04-18,04-19,04-20</font>
					</div>
				</li>
				<li>
					<a href="show.html">
						<img src="assets/images/image.png" alt="">
						<span>深圳市出发</span>
					</a>
					<div class="order-right">
						<h2>【纯玩】三亚蜈支洲岛南湾猴岛西岛南山四天双飞团</h2>
						<span>天数：4天</span><b>￥1899</b>
						<font>团期：04-18,04-19,04-20</font>
					</div>
				</li>
				<li>
					<a href="show.html">
						<img src="assets/images/image.png" alt="">
						<span>深圳市出发</span>
					</a>
					<div class="order-right">
						<h2>【纯玩】三亚蜈支洲岛南湾猴岛西岛南山四天双飞团</h2>
						<span>天数：4天</span><b>￥1899</b>
						<font>团期：04-18,04-19,04-20</font>
					</div>
				</li>-->
			</ul>
			<!-- <div class="wu">
            <img src="assets/images/img.png" alt="">
            <p>暂无记录</p>
        </div> -->
			<div id="loading">数据加载中...</div>
			<div id="nomoreData">亲，已经加载完了！</div>
		</div>
		<div id="toast" style="z-index: 10;position: fixed;"></div>
		<script src="assets/js/jquery.min.js"></script>
		<script src="assets/js/amazeui.min.js"></script>
		<!--<script src="http://code.jquery.com/jquery-2.2.0.min.js"></script>-->
		<script src="assets/js/allUse.js"></script>
		<script>
//			 数量减
			TotalPrice();
			$(".minus").click(function() {
				var t = $(this).parent().find('.am-num-text');
				t.val(parseInt(t.val()) - 1);
				if(t.val() <= 0) {
					t.val(0);
				}
				TotalPrice();
			});
			// 数量加
			$(".plus").click(function() {
				var t = $(this).parent().find('.am-num-text');
				t.val(parseInt(t.val()) + 1);
				if(t.val() <= 1) {
					t.val(1);
				}
				TotalPrice();
			});
			function TotalPrice() {
				var oprice = 0;
				$(".GoodsCheck").each(function() {
					if($(this).is(":checked")) {
						var price = parseFloat($(this).parents(".one-goods").find(".GoodsPrice").text());
						var num = parseInt($(this).parents(".one-goods").find(".am-num-text").val());
						var total = price * num;
						oprice += total;
					}
					$(".ShopTotal").text(oprice.toFixed(2));
				});
			}
		</script>
		<script type="text/javascript">
			$(document).ready(function() {
				$("#Sort-Sort li").click(function() {
					$("#Sort-Sort li").removeClass("chack");
					$(this).addClass("chack");
					$("#Sort-Sort li img").addClass("img1");
					$(this).find("img").removeClass("img1")
				});
				$("body").css("min-height",clientHeight+"px")
				//console.log(clientHeight)
				$("#gradet li a").click(function(k, v) {
					//console.log($(this).html());
					$("#gradet li a").each(function() {
						$(this).css({
							"color": "#666",
							"background": "#fff"
						});
					});
					$(this).css({
						"color": "#fff",
						"background": "#69bae0"
					});
				});
				$(".screening ul li").click(function() {
				$(".screening ul li").removeClass("color");
				$(this).addClass("color");
				})
				$(".hunt-left li ").click(function() {
					$(".hunt-left li").removeClass("active");
					$(this).addClass("active");
				})
				$(".hunt-right span ").click(function() {
					$(".hunt-right span").removeClass("active");
					$(this).addClass("active");
				})
			});
			
		</script>
		<!--7.1列表页-->
		<script type="text/javascript">
			$(document).ready(function(){
				var req,encode_req,main_type_id,num_int_time,select_type;
				var id=0,city="深圳",int_time="",fina_time="",period=0;
				var time_flag=true;
				var ToNext=false;
				var that=this;
				var their=that;
				var Pagetoken="";
				var search_token="";
				var sort=$("#Sort-Sort li.chack").attr("sort")===undefined ? 0 :$("#Sort-Sort li.chack").attr("sort");
//				console.log(sort)
				//以下 目的地列表
				(function($){
					//	4.1大分类列表
					if(JSON.parse(window.sessionStorage.getItem("major_classfiy"))){
						var data=JSON.parse(window.sessionStorage.getItem("major_classfiy"));
						for(var i=0;i<data.data.length;i++){
							$(".hunt-left").append('<li main_type_id='
							+data.data[i].id+'><a href="#">'
							+data.data[i].type_name+'</a></li>')
						};
						//var id=$(".hunt-left li").eq(0).attr("main_type_id");
						var id=GetQueryString('id');
						$(".hunt-left li[main_type_id="+id+"]").addClass("active");
						var main_type_id;
						showRight(id,main_type_id);
					}else{
						$.ajax({
							type: "get",
							url: url_enter+"/api/get_travel_main_type",
							headers:headers,
							data: {},
							success: function(data, status, xhr) {
								for(var i=0;i<data.data.length;i++){
									$(".hunt-left").append('<li main_type_id='
									+data.data[i].id+'><a href="#">'
									+data.data[i].type_name+'</a></li>')
								};
									var id=$(".hunt-left li").eq(0).attr("main_type_id");
									$(".hunt-left li[main_type_id="+id+"]").addClass("active");
									var main_type_id=$(".hunt-left li").eq(0).attr("main_type_id");
									showRight(id,main_type_id);
							}
						
						
						})
					}
					function showRight(id,main_type_id){//渲染右边列表
						 $(".hunt-right").html("");
						$.ajax({
							type:"get",
							url:url_enter+"/api/get_destination_list",
							header:headers,
							data:{
								"main_type_id":id
							},
							success:function(data){
								if(data.data){//渲染右边列表
									for(var i=0;i<data.data.length;i++){
										$(".hunt-right").append('<h2>'
										+data.data[i].sec_type_name+'</h2>');
										//console.log(data.data[i].sec_type_name)
										if(data.data[i].third_type){
										for(var j=0;j<data.data[i].third_type.length;j++){
											//console.log(data.data[i].third_type[j].third_type_name);
											$('.hunt-right h2').eq(i).after('<a href="list.html?third_type_id='
											+data.data[i].third_type[j].third_type_id+'&main_type='+id+'&name='+data.data[i].third_type[j].third_type_name+'"><span>'
											+data.data[i].third_type[j].third_type_name+'</span></a>')
										}
										}else{
											continue;
										}
									}
									
								}
							},
							error:function(xhr, status, thrown){
								console.log(xhr);
							},
							complete:function(){
								ClickRight(main_type_id);
							}
						})
					}
					function ClickRight(main_type_id){
							$(".hunt-left li").click(function(){//右边相应的地址展示
						 		var id1=$(this).attr("main_type_id")
						    $(".hunt-left li").removeClass("active");
						     $(this).addClass("active");
						    if(main_type_id==$(this).attr("main_type_id")){
						    	return;
						    };
						    main_type_id=$(this).attr("main_type_id"); 
						    
						    $(".hunt-right").html("");
						    
						    $.ajax({
						    	type:"get",
						    	url:url_enter+"/api/get_destination_list",
						    	header:headers,
						    	data:{
						    		"main_type_id":main_type_id
						    	},
						    	success:function(data){
						    		console.log()
						    		console.log(data)
						    		if(data.data){//渲染右边列表
						    			for(var i=0;i<data.data.length;i++){
						    				$(".hunt-right").append('<h2>'+data.data[i].sec_type_name+'</h2>');
						    				//console.log(data.data[i].sec_type_name)
						    				if(data.data[i].third_type){
						    					for(var j=0;j<data.data[i].third_type.length;j++){
						    					//console.log(data.data[i].third_type[j].third_type_name);
						    					$('.hunt-right h2').eq(i).after('<a href="list.html?third_type_id='
															+data.data[i].third_type[j].third_type_id+'&main_type='+main_type_id+'&name='+data.data[i].third_type[j].third_type_name+'"><span>'
															+data.data[i].third_type[j].third_type_name+'</span></a>')
						    				}
						    				}else{
						    					continue;
						    				}
						    				
						    			}
						    		}
						    	},
						    	error:function(xhr, status, thrown){
						    		console.log(xhr);
						    	}
						    })
						   
						})
					}					
								
				})(jQuery)
				//以上目的地列表
				//以下按行程ajax
					$("#init_time").change(function(){
						int_time=$("#init_time").val();
						 fina_time=$("#fina_time").val();
						 
					 	  num_int_time=int_time.split("-").join("");
						  num_fina_time=fina_time.split("-").join("");
							 if(num_fina_time-num_int_time<0 && num_fina_time){
							 		showToast("初始日期不可晚于"+fina_time);
							 		time_flag=false;
							 }else{
							 	time_flag=true;
							 }
					});
					 $("#fina_time").change(function(){
					 	int_time=$("#init_time").val();
						fina_time=$("#fina_time").val();
						 
					 	num_int_time=int_time.split("-").join("");
						num_fina_time=fina_time.split("-").join("");
							 if(num_fina_time-num_int_time<0){
							 		showToast("截止日期不可早于"+int_time);
							 		time_flag=false;
							 }else{
							 	time_flag=true;
							 }
					 })
					$("#time_btn").click(function(){
						flagL=true;flagC=true;flagR=true;
						nowHide()
						if(time_flag){
							if(select_type==false){
								search_token="";
								req='{"city":"深圳","dest_id":0,"dest_level":0,"time_start":"'
								+int_time+'","time_end":"'
								+fina_time+'","days":'
								+period+',"sort_type":'
								+sort+',"main_type":0,"next_page_token":""}'
								search(val,search_token,true,req);
							}else{
								Pagetoken="";
								period=$("#period").val();
								req='{"city":"'
								+city+'","dest_id":'
								+third_type_id+',"dest_level":'
								+dest_level+',"time_start":"'
								+int_time+'","time_end":"'
								+fina_time+'","days":'
								+period+',"sort_type":'
								+sort+',"main_type":'
								+id+',"next_page_token":"'
								+Pagetoken+'"}';
								begin(true);
							}
//							$(document).scrollTop($(document).scrollTop()-1);//防止滑动到底部没有pagetoken后无法显示loading
//							show_hide(false);
							that=this;
							$("#time_box").animate({"top":"-65%"},50);
							flagC=true;
						}else{
							showToast("请填写正确的出发时间");
						}
					})
				//以上按行程ajax
				//以下筛选 ajax
					$("#Sort-Sort li").click(function(){
						flagL=true;flagC=true;flagR=true;
						nowHide();
						Pagetoken="";
						$(document).scrollTop($(document).scrollTop()-1);
						show_hide(false);
						sort=$(this).attr("sort");
						if(select_type==false){
							search_token="";
							req='{"city":"深圳","dest_id":0,"dest_level":0,"time_start":"'
							+int_time+'","time_end":"'
							+fina_time+'","days":'
							+period+',"sort_type":'
							+sort+',"main_type":0,"next_page_token":""}'
							search(val,search_token,true,req);
						}else{
							req='{"city":"'
							+city+'","dest_id":'
							+third_type_id+',"dest_level":'
							+dest_level+',"time_start":"'
							+int_time+'","time_end":"'
							+fina_time+'","days":'
							+period+',"sort_type":'
							+sort+',"main_type":'
							+id+',"next_page_token":"'
							+Pagetoken+'"}'
							encode_req=encodeURIComponent(req);
							that=this;
							begin(true);
						}
						
						$("#filter_box").animate({"top":"-65%"},50);
						flagR=true;
						
					})
				//以上筛选 ajax
				var dest_level=0;//地区级别分类
				//一级id
				var third_type_id=0;//3级地区
				var name=GetQueryString("name")
				$("#from_idx").html(name)
				if(GetQueryString("third_type_id") && GetQueryString("main_type")){
					third_type_id=GetQueryString("third_type_id");
					dest_level=3;
					id=GetQueryString("main_type");
					//console.log(third_type_id);
					req='{"city":"深圳","dest_id":'+third_type_id+',"dest_level":'+dest_level+',"time_start":"","time_end":"","days":0,"sort_type":0,"main_type":'+id+',"next_page_token":""}'
					encode_req=encodeURIComponent(req);
					that=this;
					begin(true);
				};
				if(GetQueryString("id")){				
					var major_name=GetQueryString("name")
					id=GetQueryString("id");

					Pagetoken="";
					req='{"city":"深圳","dest_id":0,"dest_level":0,"time_start":"","time_end":"","days":0,"sort_type":0,"main_type":'+id+',"next_page_token":"'+Pagetoken+'"}';
					that=this;
					begin(true);
				}else{
					
				}
				//以下 弹出 按地区搜索弹出来
				var flagL=true;
				var flagC=true;
				var flagR=true;
				(function($){
					$(".Regional").click(function(){
	//					$("#destination").animate({"top":"15%"},100)
						if(flagL==true){
							if(flagC==false){
								$("#time_box").animate({"top":"-65%"},50)
								flagC=true;
							}
							if(flagR==false){
								$("#filter_box").animate({"top":"-65%"},50)
								flagR=true
							}
							$("#destination_box").animate({"top":"7rem"},50)	
							flagL=false;
							
						}else{
							$("#destination_box").animate({"top":"-65%"},50)
							flagL=true;

						}
						nowHide()
					});
					
				})(jQuery)
				function nowHide(){
					if(flagL && flagC && flagR){
						$(".shadow").hide()
					}else{
						$(".shadow").show()
					}
				}
				//以上 弹出按地区搜索弹出来
				//以下按时间弹出来
					timing();
				function timing(){
					$(".Brand").click(function(){
						if(flagC){
							if(flagL==false){
								$("#destination_box").animate({"top":"-65%"},50)
								flagL=true;
							}
							if(flagR==false){
								$("#filter_box").animate({"top":"-65%"},50)
								flagR=true
							}
							$("#time_box").animate({"top":"7rem"},50)
							flagC=false
							
						}else{
							$("#time_box").animate({"top":"-65%"},50)
							flagC=true;
						}
						nowHide()
					})
				}
				//以上按时间弹出来
				//以下 筛选弹窗
					Selection();
					function Selection(){
						$(".Sort").click(function(){
							if(flagR){
								if(flagL==false){
									$("#destination_box").animate({"top":"-65%"},50)
									flagL=true;
								};
								if(flagC==false){
									$("#time_box").animate({"top":"-65%"},50)
									flagC=true;
								};
								$("#filter_box").animate({"top":"7rem"},50)
								flagR=false
							}else{
								$("#filter_box").animate({"top":"-65%"},50)
								flagR=true
							}
							nowHide()
						})
						
					}
				//以上筛选弹窗
				//以下 搜索
				function search(val,search_toke,flag,req){
					if(window.sessionStorage.getItem("realposition")){
						var position_city=window.sessionStorage.getItem("realposition");
					}else{
						var position_city="深圳"
					};
					if(val===""){
						return
					}else{//调搜索ajax
						if(search_token==="" && flag===true){//第一次点击 搜索
							$(".ly").html("");
						};
						var encode_req=encodeURIComponent(req);
						$.ajax({
							type:"post",
							url:url_enter+"/api/search_line_by_key",
							data:{
								"keyword":''+val+'',
								"req":''+encode_req+''
							},
							success:function(data){
								console.log(req);
								console.log(val)
								console.log(data)
								if(data.result===1){
									if(data.data.line_list===null && flag===true){
										$("#loading").hide();
										showToast("这里暂时没有线路哦~")
										$("#loading").hide();
										$("#nomoreData").hide();
									}else{
										if(data.data.line_list===null){
											return;
										};
										for(var i=0;i<data.data.line_list.length;i++){
											$(".ly").append('<li><a href="show.html?line_id='
											+data.data.line_list[i].line_id+'"><div class="left_div"><img src="'
											+data.data.line_list[i].image+'"><span>'
											+data.data.line_list[i].depart+'出发</span></div><div class="order-right"><h2>'
											+data.data.line_list[i].title+'</h2><span>天数：'
											+data.data.line_list[i].days+'天</span><b>￥'
											+data.data.line_list[i].price+'</b><font>团期:'
											+data.data.line_list[i].time_select+'</font></div></a></li>')
										};	
										search_token=data.data.next_page_token;
											if(search_token){
												$("#loading").show();
												$("#nomoreData").hide();
												$(window).scroll(function(){
													var scrollHeight=$(document).height();
													var scrollTop=$(this).scrollTop();
													var windowHeight =$(this).height();
													if(scrollTop + windowHeight>=scrollHeight){
														flag=false;
														console.log(val+","+search_token+","+flag)
														search(val,search_token,flag,req);　
												    　}
												})
												
											}else{
												search_token=""
												$("#loading").hide();
												$("#nomoreData").show();
											}
										
									}
								}else{
									alert(data.message)
								}
							},
							error: function(xhr, status, thrown) {
								console.log(xhr);
							}
						});
					};
				};
				$("#search_btn").click(function(){
					$("#loading").show();
					$("#nomoreData").hide();
					val=$.trim($("#txt").val());
					if(val==""){
						return
					};
					select_type=false;
					req='{"city":"深圳","dest_id":0,"dest_level":0,"time_start":"","time_end":"","days":0,"sort_type":0,"main_type":0,"next_page_token":""}'
					search_token="";
					search(val,search_token,true,req);
					
				});
				$(".search_inpt").on("keypress",function(e){
					var keycode = e.keyCode;  
	                var searchName = $(this).val();
	                search_token="";
	                if(keycode=='13') {  
	                    e.preventDefault();
	                    show_hide(false);
	                    //请求搜索接口  
	                    if(val==""){
							return
						};
						select_type=false;
	                    val=$.trim($(this).val());
	                    req='{"city":"深圳","dest_id":0,"dest_level":0,"time_start":"","time_end":"","days":0,"sort_type":0,"main_type":0,"next_page_token":""}'
						search(val,search_token,true,req);
	                }; 
				});	
				//以上搜索
				function begin(flag){
					if(flag){
						$(".ly").html("");
					}
					$("#loading").show();
							$("#nomoreData").hide();
//					if(their!=that){
//						alert()
//					}
//					their=that;
console.log(req)
					var encode_req=encodeURIComponent(req)
					$.ajax({
						type: "post",
						url: url_enter+"/api/get_lines_by_condition",
						Header:headers,
						async:true,
						data: {
							"req":encode_req
						},
						success: function(data, status, xhr) {
							console.log(data)
							if(data.data.line_list==null){
								$("#loading").hide();
								showToast("这里暂时没有线路哦~")
								$("#loading").hide();
								$("#nomoreData").hide();
								return;
							};
							if(!data.data.next_page_token){
								show_hide(true)
							}
							if(ToNext){
								console.log("还没准备好")
								return;
							};
//							$("body").removeClass("search_body");
								ToNext=true;
								
							for(var i=0;i<data.data.line_list.length;i++){
								$(".ly").append('<li><a href="show.html?line_id='
								+data.data.line_list[i].line_id+'"><div class="left_div"><img src="'
								+data.data.line_list[i].image+'"><span>'
								+data.data.line_list[i].depart+'出发</span></div><div class="order-right"><h2>'
								+data.data.line_list[i].title+'</h2><span>天数：'
								+data.data.line_list[i].days+'天</span><b>￥'
								+data.data.line_list[i].price+'</b><font>团期:'
								+data.data.line_list[i].time_select+'</font></div></a></li>')
							};
								console.log(data.data.next_page_token);
								console.log(req);
								Pagetoken=data.data.next_page_token;
								
						},
						error: function(xhr, status, thrown) {
							console.log(xhr);
						},
						complete:function(){
							ToNext=false
						}
					});	
				}
				$(window).scroll(function scroll(){
					var scrollHeight=$(document).height();
					var scrollTop=$(this).scrollTop();
					var windowHeight =$(this).height();
					if(scrollTop + windowHeight === scrollHeight && scrollTop>0){
					if(Pagetoken){//存在下一页
						show_hide(false);
							console.log(2222);
					    　　　req='{"city":"'
							+city+'","dest_id":'
							+third_type_id+',"dest_level":'
							+dest_level+',"time_start":"'
							+int_time+'","time_end":"'
							+fina_time+'","days":'
							+period+',"sort_type":'
							+sort+',"main_type":'+id+',"next_page_token":"'
							+Pagetoken+'"}';
							
							begin(false);
					    　　
					}else{
						Pagetoken="";
						show_hide(true);
						
					}};
					if(search_token){//存在搜索翻页
						show_hide(false);
						var scrollHeight=$(document).height();
						var scrollTop=$(this).scrollTop();
						var windowHeight =$(this).height();
						if(scrollTop + windowHeight === scrollHeight){
							console.log(val)
							search(val,search_token,false);
//					    　　　req='{"city":"'
//							+city+'","dest_id":'
//							+third_type_id+',"dest_level":'
//							+dest_level+',"time_start":"'
//							+int_time+'","time_end":"'
//							+fina_time+'","days":'
//							+period+',"sort_type":'
//							+sort+',"main_type":'+id+',"next_page_token":"'
//							+Pagetoken+'"}';
//							
//							begin(false);
						}
					}
				})
				function show_hide(flag){
					if(flag){
						$("#loading").hide();
						$("#nomoreData").show();
					}else{
						$("#loading").show();
						$("#nomoreData").hide();
					}
				}
				
			})
			
		</script>
		<!--8.3产品详情，分类详情-->
		
	</body>

</html>